#pragma once

#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

#define FILE_SIZE 16

typedef enum FLUSHMOD
{
	_NONE=1,	//没有缓冲
      	_LINE,		//行缓冲
	_FULL		//全缓冲
}FLUSHMOD;
typedef enum OPENMOD
{
	_READONLY=1,	//只读
      	_WRITEONLY,	//只写
	_APPEND		//追加
}OPENMOD;
typedef struct IO_FILE
{
	FLUSHMOD flushmod;
	OPENMOD openmod;
	int fileno;
	char outbuffer[FILE_SIZE];
	int cap;
	int size;
}MYFILE ;


MYFILE* mfopen(const char* filename, const char* mod);
int mfwrite(void* ptr, int num, MYFILE* stream);
int mfread(void* ptr, int num, MYFILE* stream);
void mfflush(MYFILE* stream);
void mfclose(MYFILE* stream);
